home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Text⁄Files / Tape Stuff / Pascal Strings / Pstrspn.c < prev   
Encoding:
C/C++ Source or Header  |  1992-10-24  |  642 b   |  37 lines  |  [TEXT/KAHL]

  1. /****************************************************************************
  2.  *
  3.  * FILE:    Pstrspn.c
  4.  * CREA:    Sven Axelsson, GU
  5.  * MODF:    fredag 13 april 1990 @ 12.36.11
  6.  * HIST:    90-04-13 (1.0)    First version.
  7.  *
  8.  ****************************************************************************/
  9.  
  10. # include    "pstring.h"
  11.  
  12.  
  13. short
  14. Pstrspn(
  15.     register Str255            s1,
  16.     register Str255            s2 )
  17. {
  18.     register unsigned int    i,
  19.                             j;
  20.     unsigned int            l1 = s1[0],            
  21.                             l2 = s2[0];
  22.     
  23.     if( l2 == 0 ) {
  24.         return( 0 );
  25.     }
  26.     
  27.     for( i = 1; i <= l1; i++ ) {
  28.         for( j = 1; j <= l2; j++ ) {
  29.             if( s1[i] != s2[j] ) {
  30.                 goto exit;
  31.             }
  32.         }
  33.     }
  34.  
  35. exit:    
  36.     return( --i );
  37. }